package com.chengzhi.structure;

/**
 * @description: 线段树测试
 * @author: ruanchengzhi
 * @create: 2020-03-13 10:39
 **/
public class SegmentTreeTest {
    public static void main(String[] args) {
        Integer[] arr = {-1, 2, 3, 4, 6,-9, 11};
        Merge<Integer> merge = (left, right) -> left + right;
        SegmentTree tree = new SegmentTree(arr, merge);
        System.out.println(tree);
        System.out.println(tree.query(3, 3));
        tree.set(0, 5);
        System.out.println(tree.query(0, 1));
    }
}
